/*
Copyright (c) [2019年5月1日] [吴超]
[MBT_studio] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
		 http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#include "stdafx.h"
#include "S_场景图层.h"

#include "S_键值序列容器.h"

static S_键值序列容器<uint32, S_集合*> g_集合容器;




inline S_集合::S_集合(uint32 key) : S_Object(key) {
	if (g_集合容器.f_Key存在(key)) {
		key = g_集合容器.f_GenName(key);
	}
	g_集合容器.f_add(this, key);

	m_ID = key;
}




void f_添加物体(S_集合* 集合, S_物体* obj, uint32* 子到父ID, int32 d) {
	auto 迭代器 = 集合->m_子层.find(子到父ID[d]);
	if (迭代器 != 集合->m_子层.end()) {
		集合->m_子层[子到父ID[d]] = new S_集合;
	}

	if (d <= 0) {
		集合->m_物体.push_back(obj);
	}
	else {
		S_集合* c = 集合->m_子层[子到父ID[d]];
		f_添加物体(c, obj, 子到父ID, d - 1);
	}
	

	

}





S_集合* S_集合::f_get(uint32 key) {
	if(g_集合容器.f_Key存在(key)) return g_集合容器[key];
	else return 0;
}





